All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.event.TreeModelEvent

java.lang.Object
   |
   +----java.util.EventObject
           |
           +----com.sun.java.swing.event.TreeModelEvent

public class TreeModelEvent
extends EventObject
Encapsulates information describing changes to a tree model, and used to notify tree model listeners of the change.

Warning: serialized objects of this class will not be compatible with future swing releases. The current serialization support is appropriate for short term storage or RMI between Swing1.0 applications. It will not be possible to load serialized Swing1.0 objects with future releases of Swing. The JDK1.2 release of Swing will be the compatibility baseline for the serialized form of Swing objects.


Variable Index

 o childIndices
Indices identifying the position of where the children were.
 o children
Children that have been removed.
 o path
Path to the parent of the nodes that have changed.

Constructor Index

 o TreeModelEvent(Object, Object[])
Used to create an event when nodes have been inserted, a node has changed, or the node structure has changed in some way, identifying the path to the change as an array of Objects.
 o TreeModelEvent(Object, Object[], int[], Object[])
Used to create an event when nodes have been changed, inserted, or removed; identifying the path to the parent of the modified items as an array of Objects.
 o TreeModelEvent(Object, TreePath)
Used to create an event when nodes have been inserted, a node has changed, or the node structure has changed in some way, identifying the path to the change as a TreePath object.
 o TreeModelEvent(Object, TreePath, int[], Object[])
Used to create an event when nodes have been removed, identifying the path to the parent of the removed items as a TreePath object.

Method Index

 o getChildIndices()
Returns the values of the child indexes.
 o getChildren()
Returns the objects that are children of the node identified by getPath at the locations specified by getChildIndices.
 o getPath()
Convenience method to get the array of objects from the TreePath instance that this event wraps.
 o getTreePath()
Returns the TreePath object identifying the changed node.
 o toString()
Returns a string that displays and identifies this object's properties.

Variables

 o path
 protected TreePath path
Path to the parent of the nodes that have changed.

 o childIndices
 protected int childIndices[]
Indices identifying the position of where the children were.

 o children
 protected Object children[]
Children that have been removed.

Constructors

 o TreeModelEvent
 public TreeModelEvent(Object source,
                       Object path[],
                       int childIndices[],
                       Object children[])
Used to create an event when nodes have been changed, inserted, or removed; identifying the path to the parent of the modified items as an array of Objects. All of the modified objects are siblings which are direct descendents (not grandchildren) of the specified parent. ----TO BE VERIFIED---(eta) ---TO BE DETERMINED: INDICES SPECIFIED AS "1,3,5" for a 5-child list or as "1,2,3" ??

Parameters:
source - the Object responsible for generating the event (typically the creator of the event object passes this for its value)
path - an array of Object identifying the path to the parent of the removed item(s), where the first element of the array is the Object stored at the root node and the last element is the Object stored at the parent node
childIndices - an array of int that specifies the index values of the removed items
children - an array of Object the orphaned child objects
 o TreeModelEvent
 public TreeModelEvent(Object source,
                       TreePath path,
                       int childIndices[],
                       Object children[])
Used to create an event when nodes have been removed, identifying the path to the parent of the removed items as a TreePath object. All of the removed objects must have been direct descendents (not grandchildren) of the specified parent. ----TO BE VERIFIED---(eta)

Parameters:
source - the Object responsible for generating the event (typically the creator of the event object passes this for its value)
path - a TreePath object that identifies the path to the parent of the removed item(s). In the DefaultTreeModel, this object contains an array of user-data objects, but a subclass of TreePath could use some totally different mechanism -- for example, a node ID number
childIndices - an array of int that specifies the index values of the removed items
children - an array of Object the orphaned child objects
See Also:
TreeModelEvent, TreePath
 o TreeModelEvent
 public TreeModelEvent(Object source,
                       Object path[])
Used to create an event when nodes have been inserted, a node has changed, or the node structure has changed in some way, identifying the path to the change as an array of Objects. ----TO BE VERIFIED---(eta)

When the object data at a node has changed, the path points to the changed item. When nodes have been inserted or the tree's structure has changed, the path points to the parent of the changes. A "structure change" might involve nodes swapping position, for example, or it might encapsulate multiple inserts and deletes (without identifying which nodes have been removed).

Parameters:
source - the Object responsible for generating the event (typically the creator of the event object passes this for its value)
path - an array of Object identifying the path to the change, where the first element of the array is the object stored at the root node and the last element is the object stored at the changed node
 o TreeModelEvent
 public TreeModelEvent(Object source,
                       TreePath path)
Used to create an event when nodes have been inserted, a node has changed, or the node structure has changed in some way, identifying the path to the change as a TreePath object. ----TO BE VERIFIED---(eta)

When the object data at a node has changed, the path points to the changed item. When nodes have been inserted or the tree's structure has changed, the path points to the parent of the changes. A "structure change" might involve nodes swapping position, for example, or it might encapsulate multiple inserts and deletes (without identifying which nodes have been removed).

Parameters:
source - the Object responsible for generating the event (typically the creator of the event object passes this for its value)
path - a TreePath object that identifies the path to the change. In the DefaultTreeModel, this object contains an array of user-data objects, but a subclass of TreePath could use some totally different mechanism -- for example, a node ID number
See Also:
TreeModelEvent, TreePath

Methods

 o getTreePath
 public TreePath getTreePath()
Returns the TreePath object identifying the changed node. Use getLastPathComponent on that object to get the data stored at that node.

Returns:
the TreePath object identifying the changed node
See Also:
getLastPathComponent
 o getPath
 public Object[] getPath()
Convenience method to get the array of objects from the TreePath instance that this event wraps.

Returns:
an array of Objects, where the first Object is the one stored at the root and the last object is the one stored at the node identified by the path
 o getChildren
 public Object[] getChildren()
Returns the objects that are children of the node identified by getPath at the locations specified by getChildIndices. If this is a removal event the returned objects are no longer children of the parent node.

Returns:
an array of Object containing the children specified by the event
See Also:
getPath, getChildIndices
 o getChildIndices
 public int[] getChildIndices()
Returns the values of the child indexes. If this is a removal event the indexes point to locations in the initial list where items were removed. If it is an insert, the indices point to locations in the final list where the items were added. For node changes, the indices point to the locations of the modified nodes.

Returns:
an array of int containing index locations for the children specified by the event
 o toString
 public String toString()
Returns a string that displays and identifies this object's properties.

Returns:
a String representation of this object
Overrides:
toString in class EventObject

All Packages  Class Hierarchy  This Package  Previous  Next  Index